package com.jdrx.sw.sewage.beans.vo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ApiModel(value = "智能加药药剂对比", description = "智能加药药剂对比")
@Data
public class CdRunCurveVO implements Serializable {
	private static final long serialVersionUID = -2561004726565518666L;
	
	@ApiModelProperty(value = "点位名称")
	private String name;
	
	@ApiModelProperty(value = "点位值")
	private String value;
	
	@ApiModelProperty(value = "单位")
	private String unit;
	
	@ApiModelProperty(value = "采集时间yyyy-MM-dd HH:mm:ss")
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME, pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime dataTime;
	
	/*以下字段在数据库中不存在，是经过业务计算得出的*/
    // 间隔时间，按一定时间间隔
    private LocalDateTime intervalTime;
    
    // 处理数值精度问题
 	public String getValue() {
 		if(NumberUtils.isCreatable(value)) {
 			value = new BigDecimal(value).setScale(2, BigDecimal.ROUND_DOWN).toString();
 		}
 		return value;
 	}
}